package com.foreveross.crawl.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 定义发送到MQ的消息体 —— 生产者消息体
 * @author luofangyi
 *
 */
public class Message implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6420994736964340610L;

	@Override
	public String toString() {
		return "Message [command=" + command + ", createDate=" + createDate
				+ ", body=" + body + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((body == null) ? 0 : body.hashCode());
		result = prime * result + ((command == null) ? 0 : command.hashCode());
		result = prime * result
				+ ((createDate == null) ? 0 : createDate.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Message other = (Message) obj;
		if (body == null) {
			if (other.body != null)
				return false;
		} else if (!body.equals(other.body))
			return false;
		if (command == null) {
			if (other.command != null)
				return false;
		} else if (!command.equals(other.command))
			return false;
		if (createDate == null) {
			if (other.createDate != null)
				return false;
		} else if (!createDate.equals(other.createDate))
			return false;
		return true;
	}

	/**
	 * 命令类型： 注册、抓取数据模型等
	 */
	private String command;
	
	private Date createDate = new Date();
	
	/**
	 * 消息体
	 */
	private List<? extends Object> body;

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public List<? extends Object> getBody() {
		return body;
	}

	public void setBody(List<? extends Object> body) {
		this.body = body;
	}
	
	
}
